/*
 * @Author: Wanko
 * @Date: 2023-09-15 15:55:35
 * @LastEditors: Wanko
 * @LastEditTime: 2024-03-01 15:49:06
 * @Description: 
 */
const mongoose = require('mongoose')
const { Schema, model } = mongoose

const imageScheme = new Schema({
  __v: Number,
  id: { type: String, unique: true },
  size: Number,
  base: String,
  name: String,
  type: String,
  url: String,
  path: String,
  created_time: String
})
// 在保存文档之前，将 id 字段设置为 _id 的值
imageScheme.pre('save', function (next) {
  console.log('1111111');
  this.id = this._id.toString()
  next()
})
module.exports = model('Image', imageScheme)
